package com.lx.web;

import lombok.Data;

/**
 * @Author: LiXiang
 * @Date: 2024/2/1
 * @Description:
 */
@Data
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;

    public Result(Integer code, String msg, T t) {
        this.code = code;
        this.msg = msg;
        this.data = t;
    }


    public static <T> Result<T> success() {
        return new Result(2000,"success", null);
    }
    public static <T> Result<T> success(T data) {
        return new Result(2000,"success", data);
    }

    public static <T> Result<T> success(String msg,T data) {
        return new Result(2000,msg, data);
    }

    public static <T> Result<T> fail() {
        return new Result(2001,"fail", null);
    }
    public static <T> Result<T> fail(T data) {
        return new Result(2001,"fail", data);
    }
    public static <T> Result<T> fail(String  msg,T data) {
        return new Result(2001,msg, data);
    }
    public static <T> Result<T> fail(Integer code,String  msg) {
        return new Result(code,msg, null);
    }


}
